package cn.edu.scau.cmi.liujiaming.chapter08;

public class CargoBoat {
    int realContent;  //装载的重量
    int maxContent;   //最大装载量
    public void setMaxContent(int c) {
        maxContent = c;
    }
    public void loading(int m) throws DangerExceptions {
      realContent += m;
      if(realContent>maxContent) {
         throw new DangerExceptions(); 
      }
      System.out.println("目前装载了"+realContent+"吨货物");
    }
}